package com.coldchain.cys.api;

import com.coldchain.authclient.annotation.CheckUserToken;
import com.coldchain.common.msg.BaseResponse;
import com.coldchain.cys.entity.CysChild;
import com.coldchain.cys.mapping.ApiUtils;
import com.coldchain.cys.service.ICysChildService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tianpeng
 * @since 2018-09-11
 */
@Controller
@RestController
@ApiIgnore
@CheckUserToken
public class CysChildController {

	@Autowired
	private ICysChildService cysChildService ;
	
	/**
	 * 承运商子账号启用 禁用开关
	 * @param cysChildId
	 * @return
	 */
	@RequestMapping(value=ApiUtils.DO_SWITCH_CYS_CHILD_USE,method= {RequestMethod.POST})
	public BaseResponse doSwitchCysChildUse(Long cysChildId) {
		return cysChildService.doSwitchCysChildUse(cysChildId) ;
	}
	
	/**
	 * 添加或者编辑承运商子账号
	 * @return
	 */
	@RequestMapping(value=ApiUtils.DO_ADD_OR_EDIT_CYS_CHILD,method= {RequestMethod.POST})
	public BaseResponse doAddOrEditCysChild(CysChild cysChild) {
		return cysChildService.doAddOrEditCysChild(cysChild) ;
	}
}
